package chamber.zero.dna;

import java.util.Map;
import java.util.TreeMap;

/**
 * Created by gcortes on 11/26/13.
 */
public enum Nucleotide {
    A('A', "adenine"),
    C('C', "cytosine"),
    G('G', "guanine"),
    T('T', "thymine");
    private static final Map<Character, Nucleotide> map = new TreeMap<Character, Nucleotide>();

    static {
        for (Nucleotide nucleotide : Nucleotide.values()) {
            map.put(nucleotide.symbol, nucleotide);
        }
    }

    private final Character symbol;
    private final String name;

    Nucleotide(final Character symbol, final String name) {
        this.symbol = symbol;
        this.name = name;
    }

    public static Nucleotide of(final Character symbol) {
        return map.get(symbol);
    }

    @Override
    public String toString() {
        return name;
    }
}
